<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: ;
        }

        html {
            height: 100%;
        }

        body {
            height: 100%;
        }

        #whole {
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        #sup {
            background-color: gray;
            height: 80px;
            display:flex;
            margin:0.5em;
            justify-content: center;
        }

        #sub {
            background-color: gray;
            height: 80px;
            display:flex;
            margin:0.5em;
            justify-content: center;
        }

        #middle {
            background:cyan;
            height:50%;
            display:flex;
            justify-content: center;
            align-items: center;
            margin:1em 0.5em;
        }

        #A {
            background-color: purple;
            width:240px;
            height: 50%;
            display: flex;
            margin:1em 0.5em;
            justify-content: center;
            align-items: center;

        }

        #B {
            background-color: yellow;
            width: 70%;
            height: 80%;
            display: flex;
            margin:1em 0.5em;
        }

    </style>
</head>

<body>
    <div id="whole"> 
        <div id="sup">height:80px</div>
        <div id="middle">
            <div id="A">width:240px;</div>
            <div id="B"></div>
        </div>
        <div id="sub">height:80px</div>
    </div>

</body>

</html>